#include <bits/stdc++.h>
#include "testlib.h"

using namespace std;

const int N = 1000010;

int n, a[N], vis[N], fa[N];
vector<int> e[N];
queue<int> q;
set<int> s;

int main(int argc, char* argv[]) {
  registerTestlibCmd(argc, argv);
  n = inf.readInt();
  for (int i = 1; i < n; ++i) {
    int u = inf.readInt(), v = inf.readInt();
    e[u].emplace_back(v), e[v].emplace_back(u);
  }
  q.push(1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : e[u]) {
      if (v == fa[u]) continue;
      fa[v] = u, q.push(v);
    }
  }
  a[1] = ouf.readInt(-1, n);
  if (a[1] <= 0) quitf(_wa, "You didn't find the solution.");
  for (int i = 2; i <= n; ++i) a[i] = ouf.readInt(1, n);
  vis[1] = 1;
  for (int i = 1; i <= n; ++i) {
    int u = a[i];
    if (vis[u] != 1) quitf(_wa, "Wrong answer.");
    if (s.find(fa[u]) != s.end()) s.erase(fa[u]);
    s.insert(u), vis[u] = 2;
    if (u != *prev(s.end())) quitf(_wa, "Wrong answer.");
    for (int v : e[u]) if (v != fa[u]) vis[v] = 1;
  }
  quitf(_ok, "Accepted.");
}